<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="../menu.jsp" />
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>修改密码</title>
<link rel="stylesheet" type="text/css" href="../css/my.css" />
</head>
<body>
    <!-- 确保用户已登录 -->
    <c:if test="${empty username}">
        <script type="text/javascript">
            alert('请先登录！');
            window.location.href = '../login.jsp';
        </script>
    </c:if>
    
    <c:if test="${not empty username}">
        <h1 class="title">修改密码</h1>
        <form action="changepwd" method="post">
            <table>
                <!-- 账号字段 - 只读显示 -->
                <tr>
                    <td>账号</td>
                    <td><input type="text" name="username" value="${username}" readonly/></td>
                </tr>
                
                <!-- 旧密码 -->
                <tr>
                    <td>旧密码</td>
                    <td><input type="password" name="pwd"/></td>
                </tr>
                
                <!-- 新密码 -->
                <tr>
                    <td>新密码</td>
                    <td><input type="password" name="npwd"/></td>
                </tr>
                
                <!-- 确认新密码 -->
                <tr>
                    <td>确认新密码</td>
                    <td><input type="password" name="rpwd" /></td>
                </tr>
                
                <!-- 按钮行 -->
                <tr>
                    <td></td>
                    <td>
                        <input type="button" value="取消" onclick="window.location.href='login.jsp'"/>
                        <input type="submit" value="确认修改" />
                    </td>
                </tr>
            </table>
        </form>
    </c:if>
</body>
</html>